import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:part_time_job_pro/common/models/full_job_type.dart';
import 'package:part_time_job_pro/common/models/full_time_job.dart';
import 'package:part_time_job_pro/common/models/models.dart';
import 'package:part_time_job_pro/main.dart';

//职位接口
mixin JobMixins {
  //获取兼职类型
  Future<List<PartJobType>?> getPartJobTypeList() async {
    var result = await restClient.getPartJobTypeList();
    return result?.data;
  }

  //搜索兼职类型
  Future<List<PartJobType>?> searchPartJobType(String keyword) async {
    var result = await restClient.searchPartJobType(keyword);
    return result?.data;
  }

  //获取兼职列表
  Future<List<PartTimeJob>?> getPartTimeJobList(int pageNum, int pageSize, {String status = "1"}) async {
    Map<String, dynamic> params = {"status": status, "pageNum": pageNum, "pageSize": pageSize};
    var result = await restClient.getPartTimeJobList(params);
    return result?.data?.rows;
  }

  //获取全职类型
  Future<List<FullJobType>?> getFullJobTypeList() async {
    var result = await restClient.getFullJobTypeList();
    return result?.data;
  }

  //获取全职列表
  Future<List<FullTimeJob>?> getFullTimeJobList(int pageNum, int pageSize, {String status = "1"}) async {
    Map<String, dynamic> params = {"status": status, "pageNum": pageNum, "pageSize": pageSize};
    var result = await restClient.getFullTimeJobList(params);
    return result?.data?.rows;
  }
}
